<?php
/**
 * 报名管理
 *                    _ooOoo_
 *                   o8888888o
 *                   88" . "88
 *                   (| -_- |)
 *                    O\ = /O
 *                ____/`---'\____
 *              .   ' \\| |// `.
 *               / \\||| : |||// \
 *             / _||||| -:- |||||- \
 *               | | \\\ - /// | |
 *             | \_| ''\---/'' | |
 *              \ .-\__ `-` ___/-. /
 *           ___`. .' /--.--\ `. . __
 *        ."" '< `.___\_<|>_/___.' >'"".
 *       | | : `- \`.;`\ _ /`;.`/ - ` : | |
 *         \ \ `-. \_ __\ /__ _/ .-` / /
 * ======`-.____`-.___\_____/___.-`____.-'======
 *                    `=---='
 *
 * .............................................
 *          佛祖保佑             永无BUG
 */

namespace app\admin\controller;

\think\Loader::import('controller/Controller', \think\Config::get('traits_path') , EXT);

use app\admin\Controller;

class User extends Controller
{

    use \app\admin\traits\controller\Controller
    {
        \app\admin\traits\controller\Controller::edit as editUser;
        \app\admin\traits\controller\Controller::add as addUser;
        \app\admin\traits\controller\Controller::index as indexUser;
    }
    // 方法黑名单
    protected static $blacklist = [];

    protected function filter(&$map)
    {
        if ($this->request->param("user_name")) {
            $map['user_name'] = ["like", "%" . $this->request->param("user_name") . "%"];
        }
        if ($this->request->param("user_class")) {
            $map['user_class'] = ["like", "%" . $this->request->param("user_class") . "%"];
        }
    }

    /**
     * 对修改方法进行重写
     */
    public function edit()
    {
//       显示项目
        $kind=model("kind");
//       将在项目表被移入回收站的去掉
        $map=[
            "isdelete"=>['EQ','0'],
            "kind_name"=>['NEQ','']
        ];
        $arr2=$kind->where($map)->select();
        $stuMap=[
            'isdelete'=>['EQ','0'],
            'status'=>['NEQ','0']
        ];
        $stu=model("Stu")->where($stuMap)->select();
        $this->view->assign("stu",$stu);
        $this->view->assign("kind", $arr2);
        return $this->editUser();
    }
    /**
     * 对添加方法进行重写
     */
    public function add()
    {
//       显示项目
        $kind=model("kind");
//       将在项目表被移入回收站的去掉
        $map=[
            "isdelete"=>['EQ','0'],
            "kind_name"=>['NEQ','']
        ];
        $arr2=$kind->where($map)->select();
        $stuMap=[
            'isdelete'=>['EQ','0'],
            'status'=>['NEQ','0']
        ];
        $stu=model("Stu")->where($stuMap)->select();
        $this->view->assign("stu",$stu);
        $this->view->assign("kind", $arr2);
        return $this->addUser();
    }




}
